package router

import (
	"github.com/facebookgo/inject"
	"github.com/teambition/gear"
	"jgt-oper/src/api"
	"jgt-oper/src/context"
)

// APIContactsBookMap 企业通讯录相关接口路由
func APIContactsBookMap(g *inject.Graph, r *gear.Router) {
	a := new(api.ContactsBook)
	err := g.Provide(&inject.Object{Value: a})
	if err != nil {
		panic(err)
	}
	//企业信息：头像、名称、人员总数
	r.Get("/contacts-book/enterprise", context.WrapContext(a.Get))
	//所有的同事：名称、职称、电话、头像、认证状态、是否常用联系人
	r.Get("/contacts-book/all-colleagues", context.WrapContext(a.GetAllColleagues))
	//获取所有常用联系人
	r.Get("/contacts-book/all-frequently-used", context.WrapContext(a.GetAllFrequentlyUsed))
	//添加常用联系人
	r.Post("/contacts-book/frequently-used", context.WrapContext(a.AddFrequentlyUsed))
	//取消常用联系人
	r.Delete("/contacts-book/frequently-used", context.WrapContext(a.CancelFrequentlyUsed))
}
